﻿using System;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;

namespace Common.Location
{
    [DefaultClassOptions]
    public class Language : BaseObject
    {
        public Language(Session session)
            : base(session)
        {
        }
        public override void AfterConstruction()
        {
            base.AfterConstruction();

            _isActive = true;
            _isDefault = false;
        }
        private string _name;
        private string _tag;
        private string _code;
        private string _cultureCode;
        private Country _country;
        private bool _isActive;
        private bool _isDefault;

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                SetPropertyValue("Name", ref _name, value);
            }
        }


        public string Tag
        {
            get
            {
                return _tag;
            }
            set
            {
                SetPropertyValue("Tag", ref _tag, value);
            }
        }

        public string Code
        {
            get
            {
                return _code;
            }
            set
            {
                SetPropertyValue("Code", ref _code, value);
            }
        }
        public string CultureCode
        {
            get
            {
                return _cultureCode;
            }
            set
            {
                SetPropertyValue("CultureCode", ref _cultureCode, value);
            }
        }


        public bool IsActive
        {
            get
            {
                return _isActive;
            }
            set
            {
                SetPropertyValue("IsActive", ref _isActive, value);
            }
        }


        public bool IsDefault
        {
            get
            {
                return _isDefault;
            }
            set
            {
                SetPropertyValue("IsDefault", ref _isDefault, value);
            }
        }

        [Association("Country-Language")]
        public Country Country
        {
            get
            {
                return _country;
            }
            set
            {
                SetPropertyValue("Country", ref _country, value);
            }
        }
    }
}


